<?php
/**
 * @page search_module Search Module
 * 
 * Search module outputs a simple search form which performs search on listings and reviews.
 * 
 * @image html search_module.jpg
 * 
 */
class SearchModule extends GigaModule
{
	var $name = 'Search Module';
	var $configuration = array(
		'autocomplete'=>array()
	);
	function __construct()
	{
		$this->configuration['autocomplete'] = array("label"=>"Show Auto Complete?",'options'=>array(__('No'),__('Yes')),'default'=>1);
		$this->configuration['search_label'] = array("label"=>"Label for search field",'type'=>"text",'default'=>__("Search"));
		$this->configuration['location_search'] = array('type'=>"checkbox",'label'=>"Show text box for searching by location");
			$this->configuration['location_label'] = array("label"=>"Label for location field",'type'=>"text",'default'=>__("Location"));
	}
	function render($params)
	{		
		$viewObj = ClassRegistry::getObject('view');
        $defaults = array();
        foreach($this->configuration as $configKey => $properties)
        {
          if(!isset($params[$configKey]) && isset($properties['default']))
          {
            $params[$configKey] = $properties['default'];
          }
        }
		return $viewObj->element('search',array('showAutocomplete'=>@$params['autocomplete'],'locationSearch'=>@$params['location_search'],
		'searchLabel'=>@$params['search_label'],'locationLabel'=>@$params['location_label']));
	}
}
?>